<%@page import="java.util.*, pe.edu.upc.matrix.modelo.MPublicacion, pe.edu.upc.matrix.util.UConsultaDatos"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<% 
if(request.getSession().getAttribute("USUARIO_ACTUAL")==null){
%>
<jsp:forward page="index.jsp"/>
<%
}
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Sistema de compra y venta The Matrix</title>
		<link href="css/bootstrap-3.0.0.css" rel="stylesheet" media="screen">
	</head>
<body>
	<!--  Inicio menu -->
	<%@include file="menu.jsp"%>	
	<!--  Fin menu -->
	<div class="container" style="margin-top:-15px;">	
		<div class="panel panel-danger">
			<div class="panel-heading">
				<h3 class="panel-title">Realiza tu compra</h3>
			</div>
		</div>
		<%
		if(request.getAttribute("publicacion") != null){
			MPublicacion mPublicacion = (MPublicacion)request.getAttribute("publicacion");
		%> 
		<form name="consultas" method="post" action="SGestionarCompra?accion=registrar">
			<input type="hidden" name="idPublicacion" value="<%=mPublicacion.getIdPublicacion()%>">
			<table class="table table-striped">
				<thead>
					<tr>
			      		<th>Publicaci&oacute;n</th>
			      		<th>Categoria</th>
				  		<th>Precio</th>
				  		<th>Cantidad</th>
				  		<th>Comentario</th>
				  		<th></th>
				  		
			    	</tr>
			  	</thead>
			  	<tbody>
				    <tr>
			      	<td><%=mPublicacion.getNoTitulo() %></td>
			      	<td><%=mPublicacion.getCategoria().getNoCategoria() %></td>
			      	<td><%=mPublicacion.getQtyPrecio() %></td>
			      	<td><input name="cantidad" id="cantidad" class="form-control" type="number" min="1" required /></td>
			      	<td><textarea name="comentario" id="comentario" class="form-control" rows="3" required></textarea></td>
			      	<td><input type="submit" class="btn btn-danger" value="Comprar"></td>
				    </tr>
			  	</tbody>
			</table>
		</form>
		<%
		}
		%>
		<%@include file="informacion.jsp"%>
		<%@include file="pie.jsp"%>			      
	</div>
	<!-- Bootstrap core JavaScript
	================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->

	 <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="js/jquery-1.10.2.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="js/bootstrap-3.0.0.js"></script>
</body>
</html>